package com.he.flyweightmodel.flyweight.concreteflyweiight;

import com.he.flyweightmodel.flyweight.Shap;

/**
 * 继承fluweight类，实现flyweight接口，并为内部状态增加存储空间
 */
public class CircleShap extends Shap {
    private int radius;

    public int getRadius() {
        return radius;
    }

    {
        radius = (int) (Math.random() * 100);
    }

    /**
     * 指定内部状态
     * @param color
     */
    public CircleShap(String color) {
        super(color);
    }

    @Override
    public void color() {
        System.out.println(color + " 的圆形");

    }
}
